#include <stdio.h>
#include "funcDemo.h"
#include <stdarg.h>

// write a main function to call the function in the file
int main()
{
    int a = 5, b = 10;
    int result = add(a, b);
    printf("The sum of %d and %d is %d\n", a, b, result);
    Log("This is a log message, sum of %d and %d is %d\n", a, b, result);
    return 0;
}

int add(int a, int b)
{
    printf("file name is %s,the function name is %s, line number is %d\n", __FILE__, __func__, __LINE__);
    return a + b;
}

void Log(char *message, ...)
{
    va_list args;
    va_start(args, message);
    vprintf(message, args);
    va_end(args);
}

void ArrInit()
{
    // initialize an array of 10 integers to 0
    int arr[10] = {0};
    // equals to 
    int arr2[10] = {0, 0, 0, 0, 0};
    // print the array
    printf("The array is: ");
    for (int i = 0; i < 10; i++)
    {
        printf("%d ", arr[i]);
    }
    printf("\n");
}